% initialize
PM = Table2.ParametricMagnetometer();
PM = Table2.ParametricMagnetometer('no_laser', true);  % start without laser control

% initialize the PM again
PM.initialize();
PM.initialize('no_laser', true);

% set laser working poitn
PM.setLaserWorkingPoint();  % use default detunes


% wait for demod phase PID to converge
PM.waitForPhaseLock();



% sweep laser detune
pumpDetuneList = linspace(-3.0, +3.0, 7);
probeDetuneList = [-35:-7 , +2:+35];
calSigAmpl = 100;  %nTpk
calSigFreq = 175;
senVSlaserDetune = PM.calSensitivityVsLaserDetune(PM.actuators.ByY5, calSigAmpl, calSigFreq, pumpDetuneList, probeDetuneList);


% sweep calSigFreq
sigAmpl = 50;  %nTpk
freqRange = [2, 400];
npts = 100;
senVSfreq = PM.calSensitivityVsFreq(PM.actuators.ByY5, sigAmpl, freqRange, npts);